package com.tsd.system.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.tsd.service.BaseServiceImpl;
import com.tsd.system.dao.SysGroupPersonMapper;
import com.tsd.system.dao.SysRoleMapper;
import com.tsd.system.dao.SysUserMapper;
import com.tsd.system.service.SystemDashboardService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @ClassName: SystemDashboardServiceImpl
 * @Description: TODO
 * @Author: Hillpool
 * @Date: 2022/10/26 17:43
 * @Version: 1.0
 */
@Service
public class SystemDashboardServiceImpl extends BaseServiceImpl implements SystemDashboardService {

    @Resource
    private SysRoleMapper sysRoleMapper;
    @Resource
    private SysUserMapper sysUserMapper;
    @Resource
    private SysGroupPersonMapper sysGroupPersonMapper;

    @Override
    public JSONObject querySystemDashboard() {
        int roleNum = sysRoleMapper.countValid();
        int userNum = sysUserMapper.countValid();
        int personNum = sysGroupPersonMapper.countValid();
        JSONObject object = new JSONObject();
        object.put("role_num", roleNum);
        object.put("user_num", userNum);
        object.put("person_num", personNum);
        return object;
    }
}
